package com.atgouwu.scmall.seckill.controller;

import com.atgouwu.scmall.common.utils.R;
import com.atgouwu.scmall.seckill.feign.MemberFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("seckill/seckill")
public class SeckillController {
    @Autowired
    private MemberFeignService memberFeignService;

    /**
     * 整合OpenFeign: http://localhost:9006/search/search/orderToMember?id=1
     */
    @GetMapping("/orderToMember")
    public R orderToMember(@RequestParam("id") String id) {
        R res = memberFeignService.orderTOMember(id); //远程调用member服务
        return R.ok().put("data", res);
    }

}
